import {Clazz} from "./Clazz";
import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js';
import {DRACOLoader} from 'three/examples/jsm/loaders/DRACOLoader.js';
import * as THREE from 'three';

class House extends Clazz {
    constructor(scene, camera, renderer) {
        super();
        const _this = this;
        this.position = new THREE.Vector3();
        const dracoLoader = new DRACOLoader();
        dracoLoader.setDecoderPath('../node_modules/three/examples/jsm/libs/draco/gltf/');
        const loader = new GLTFLoader();
        loader.setDRACOLoader(dracoLoader);
        loader.load('../js/components/images/house/forest_house.glb', function (gltf) {
            gltf.scene.position.copy(_this.position.add(new THREE.Vector3(0,-85,0)));
            _this.position = gltf.scene.position;
            gltf.scene.scale.set(300, 300, 300);
            scene.add(gltf.scene);
            renderer.render(scene, camera);
        });

    }

    update() {
        super.update();
    }

}

export {House}